﻿using System;
using System.Collections;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Xml;

using Microsoft.Win32;

using Aulac.Srv.Db.Connect; using Aulac.Srv.Db.Common;
using System.Collections.Generic;
using Aulac.Global.Enums; using Aulac.Global.Data; using Aulac.Global.Common; using Aulac.Global.Xml;
using Aulac.Srv.Db.Data.Catalogs;
using Aulac.Rsc.Bss;
using Aulac.Rsc.Bss.Tags;
using Aulac.Srv.Data.XmlQuery;



namespace Aulac.Srv.Db.Data.Ems.Items
{
	/// <summary>
	/// Summary description for Caption Asset.
	/// </summary>
    public partial class CapAss : Aulac.Srv.Db.Data.Ems.Document.DbEmsDataDocumentMangager
	{
        public CapAss(IDbAulacConnect p_Db)
            : base(p_Db)
        {
        }
        List<string> mList = new List<string>(new string[] { tagItems.CapAss.CapAssPrkID, tagItems.CapAss.CapAssID, tagItems.CapAss.CapAssName });

        public XmlDataDocument GetListCapAss(XmlDataDocument xmlData)
        {
            try
            {
                string[] sArr = new string[] { tagItems.CapAss.CapAssPrkID, tagItems.CapAss.CapAssID, tagItems.CapAss.CapAssName };
                XmlDataDocument xmlDoc = CreateXmlDocument("", "");
                string sqlQuery = string.Format("SELECT	{0}", StringHelper.ConvertArrayToString(", ", sArr));
                sqlQuery += string.Format("  FROM {0}", TableNames.Dm_CapAss);
                
                SrvExecXmlQueryData query = new SrvExecXmlQueryData(DbDataProvider);
                query.SetVchLinesElm(QueryCmdTypes.SelectData);
                query.ObjQueryVchLines.SqlQueryString = sqlQuery;
                return query.ExecureQuery();
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }

        public XmlDataDocument GetListCapAssDept(XmlDataDocument xmlData)
        {
            try
            {
                XmlDataDocument xmlDoc = CreateXmlDocument("", "");
                string sqlQuery = string.Format("SELECT dbo.Dm_CapAss.CapAssPrkID, dbo.Dm_CapAss.CapAssID, dbo.Dm_CapAss.CapAssName, dbo.Dm_Department.DeptID FROM dbo.Dm_CapAss LEFT OUTER JOIN dbo.Dm_Department ON dbo.Dm_CapAss.DeptPrkID = dbo.Dm_Department.DeptPrkID");
                SrvExecXmlQueryData query = new SrvExecXmlQueryData(DbDataProvider);
                query.SetVchLinesElm(QueryCmdTypes.SelectData);
                query.ObjQueryVchLines.SqlQueryString = sqlQuery;
                return query.ExecureQuery();
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
        
	}
}
